from itertools import groupby

s= 'abbcccaa'
res = 0
for k, g in groupby(s):
    n = len(list(g))
    print(k,list(g))
    res += (n + 1) * n // 2
print(res)
for key, group in groupby('AAABBBCCAAA'):
    print(key, list(group))
c='AaaBBbcCAAa'
print( lambda c: c.upper())


